<?php
/**
 * reg controller
 * @package app-member_controller
 */
load_controller('/memberbase');
/**
 * reg controller
 * @author pandajingjing
 * @package app-member_controller
 */
class regcontroller extends memberbasecontroller{

	function doRequest(){
		$arrErrInfo=array();
		$strAction=$this->getParam('hidAction','post');
		if('reg'==$strAction){
			$strUserName=$this->getParam('txtUserName','post');
			$strUserPwd=$this->getParam('pwdUserPwd','post');
			$strUserPwdCfm=$this->getParam('pwdUserPwdCfm','post');
			load_lib('/bll/member/login');
			$clsBll=new bll_member_login();
			$mixResult=$clsBll->regUser($strUserName,$strUserPwd,$strUserPwdCfm,$this->getClientIP(),$this->getTime());
			if(is_array($mixResult)){
				$arrErrInfo=$mixResult;
			}else{
				$arrUserInfo=array(
						'USERID'=>$mixResult,
						'USERNAME'=>$strUserName
				);
				$this->setCookie('mauthcode',$clsBll->encryptLoginInfo($arrUserInfo),31536000);
				load_controller('/panel');
				$this->redirectURL(panelcontroller::getURL());
			}
		}else{
			$this->setViewState('frmReg','txtUserName','');
			$this->setViewState('frmReg','hidAction','reg');
		}
		$this->setData('arrErrInfo',$arrErrInfo);
		return '/reg';
	}

	/**
	 * 获取访问该控制器的路径
	 */
	static function getURL($p_strAction='',$p_arrParam=array(),$p_bolSecure=false,$p_strPre='/reg'){
		return parent::getURL('/reg',$p_strAction,$p_arrParam);
	}
}